//
//  StudentViewController.m
//  08_Homework
//
//  Created by 徐昊 on 16/7/25.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "StudentViewController.h"

@interface StudentViewController ()

@end

@implementation StudentViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self config];
    UILabel *name = [[UILabel alloc] initWithFrame:CGRectMake(180, 100, 80, 50)];
    name.text = _name;
    NSLog(@"%@", _name);
    name.backgroundColor = [UIColor greenColor];
    [self.view addSubview:name];
    name.textAlignment = NSTextAlignmentCenter;
    UILabel *age = [[UILabel alloc] initWithFrame:CGRectMake(180, 200, 80, 50)];
    age.text = _age;
    age.backgroundColor = [UIColor greenColor];
    age.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:age];
    UILabel *gender = [[UILabel alloc] initWithFrame:CGRectMake(180, 300, 80, 50)];
    gender.text = _gender;
    gender.backgroundColor = [UIColor greenColor];
    [self.view addSubview:gender];
    gender.textAlignment = NSTextAlignmentCenter;
    UILabel *phoneNumber = [[UILabel alloc] initWithFrame:CGRectMake(180, 400, 120, 50)];
    phoneNumber.text = _phoneNumber;
    phoneNumber.backgroundColor = [UIColor greenColor];
    [self.view addSubview:phoneNumber];
    phoneNumber.textAlignment = NSTextAlignmentCenter;
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(0, 0, 50, 50);
    button.backgroundColor = [UIColor whiteColor];
    [button setTitle:@"返回" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(handleUp:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
}
- (void)handleUp:(UIButton *)button {
    [self.navigationController popToRootViewControllerAnimated:YES];
}
- (void)config {
    UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 80, 50)];
    nameLabel.text = @"姓名";
    nameLabel.backgroundColor = [UIColor redColor];
    [self.view addSubview:nameLabel];
    nameLabel.textAlignment = NSTextAlignmentCenter;
    UILabel *ageLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 200, 80, 50)];
    ageLabel.text = @"年龄";
    ageLabel.backgroundColor = [UIColor redColor];
    ageLabel.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:ageLabel];
    UILabel *genderLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 300, 80, 50)];
    genderLabel.text = @"性别";
    genderLabel.backgroundColor = [UIColor redColor];
    [self.view addSubview:genderLabel];
    genderLabel.textAlignment = NSTextAlignmentCenter;
    UILabel *phoneNumberLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 400, 80, 50)];
    phoneNumberLabel.text = @"电话号码";
    phoneNumberLabel.backgroundColor = [UIColor redColor];
    [self.view addSubview:phoneNumberLabel];
    phoneNumberLabel.textAlignment = NSTextAlignmentCenter;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
